{include file="public/header" $title="安全设置" /}
<style>
    #editBox{
        width: 400px;display: none;
    }
</style>
</header>
<body>

<form class="layui-form" action="" style="height: 100%;margin-top: 30px">
    <div class="layui-form-item">
        <label class="layui-form-label">新密码</label>
        <div class="layui-input-inline">
            <input type="password" name="pwd" lay-verify="title|required" value="" autocomplete="off" placeholder="请输入密码：" class="layui-input" maxlength="12">
        </div>
        <div class="layui-form-mid layui-word-aux">6-12位字母数字集合</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确定新密码</label>
        <div class="layui-input-inline">
            <input type="password" name="pwd2" lay-verify="title|required" value="" autocomplete="off" placeholder="请确定密码" class="layui-input" maxlength="12">
        </div>
        <div class="layui-form-mid layui-word-aux">6-12位字母数字集合</div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="gosub" type="button">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<!--弹框结束-->
</body>
<script>
    layui.use(['form'], function(){
        var form = layui.form;

        //编辑操作
        form.on('submit(gosub)',function(data){

            if(data.field.status == 'on'){
                data.field.status = 1;
            }else{
                data.field.status = 0;
            }
            //两次密码是否一致
            if(data.field.pwd !== data.field.pwd2)
            {
                layer.msg("两次密码不一致",{icon:5,anim:6},function(){})
                return;
            }

            $.post("{:url('nadmin/personage/updatePwd')}",data.field,function(datas){
                layer.msg(datas.msg,{time:1000},function(){
                    if(datas.status == 1){
                        $('[name="pwd"]').val("")
                        $('[name="pwd2"]').val("")
                    }
                });

            },'json')
        })


    });
</script>
</html>